<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;

## Import Joomla Data
JHtml::_('behavior.tooltip');
?>
<script>
	// Show more info
	function showinfo(visi){
		var disply = visi;
		if (disply == 'show'){
			document.getElementById('evtinfo').setAttribute("style", "display:block;");
			document.getElementById('evthelp').setAttribute("onclick", "showinfo('hide')");
			document.getElementById('evthelp').innerHTML = "<?php echo JText::_('COM_JOOSAM_VIEW_EVENTS_CLICK_HIDEALL'); ?>";
		}
		else{
			document.getElementById('evtinfo').setAttribute("style", "display:none;");
			document.getElementById('evthelp').setAttribute("onclick", "showinfo('show')");
			document.getElementById('evthelp').innerHTML = "<?php echo JText::_('COM_JOOSAM_VIEW_EVENTS_CLICK_SHOWALL'); ?>";
		}
	}

	// SAM Warning Show
	function samServerShow(){
		document.getElementById('samrverh').setAttribute("style", "height:30px;line-height:30px;width:200px;margin:auto;font-size:20px;color:#c8c8c8;display:none;text-align:center;");
		document.getElementById('samserverh').setAttribute("style", "width:230px;height:36px;overflow:hidden;margin:0;padding:5px;display:block;background:#00ffff;border-radius:5px;border:1px solid #003399;");
	}

	// SAM Warning Hide
	function samServerHide(){
		document.getElementById('samrverh').setAttribute("style", "height:30px;line-height:30px;width:200px;margin:auto;font-size:20px;color:#c8c8c8;display:block;text-align:center;");
		document.getElementById('samserverh').setAttribute("style", "width:230px;height:36px;overflow:hidden;margin:0;padding:5px;display:none;background:#00ffff;border-radius:5px;border:1px solid #003399;");
	}
</script>

<div style="background: rgba(000, 255, 255, 0.1); float:right; margin:-60px -11px 0 0; padding:0; width:230px; height:30px; border-radius:10px;">
	
	<div id="samrverh" onmouseover="samServerShow()" style="height:30px;line-height:30px;width:200px;margin:auto;font-size:20px;color:#c8c8c8;display:block;text-align:center;">»<?php echo JText::_('COM_JOOSAM_WARNING'); ?>«</div>
	<div style="display:none;" id="samserverh" onmouseout="setTimeout('samServerHide()',3000);">
		 <span style="color:#ff0033;font-size:36px; font-weight:bold; float:left;">!</span>
		 
		 <p style="padding-left:4px; padding-top:2px; font-size:13px;"><?php echo JText::_('COM_JOOSAM_CONNECT_SAMDB'); ?></p>
	</div>
</div>

<!-- Form start -->
<form action="<?php echo JRoute::_('index.php?option=com_joosam&view=events'); ?>" method="post" name="adminForm" id="adminForm">
	<fieldset class="jsamLegend">
		
		<legend><?php echo JText::_('COM_JOOSAM_VIEW_EVENTS'); ?></legend>
		<div style="border-bottom:1px solid; margin-bottom:5px;">
			<span><?php echo JText::_('COM_JOOSAM_VIEW_EVENTS_INTRO_INFO'); ?></span>
			<span title="Page will not be reloaded by clicking here." style="color:#0000ff; font-weight:bold; cursor:pointer;" id="evthelp" onclick="showinfo('show')">
				<?php echo JText::_('COM_JOOSAM_VIEW_EVENTS_CLICK_SHOWALL'); ?>
			</span>
		</div>
		<div id="evtinfo" style="display:none;">
			<?php echo $this->loadTemplate('info');?>
		</div>
	</fieldset>
	<fieldset class="jsamLegend">
		<table class="adminlist">
			<thead>
				<tr>
					
					<th width="5"><?php echo JText::_('COM_JOOSAM_THEAD_ID'); ?></th>
					
					<th width="35"><?php echo JText::_('COM_JOOSAM_THEAD_SELECT'); ?></th>
					
					<th width="100"><?php echo JText::_('COM_JOOSAM_THEAD_NAME'); ?></th>
					
					<th width="120"><?php echo JText::_('COM_JOOSAM_THEAD_START'); ?></th>
					
					<th width="120"><?php echo JText::_('COM_JOOSAM_THEAD_END'); ?></th>
					
					<th width="100"><?php echo JText::_('COM_JOOSAM_THEAD_REPEAT'); ?></th>
					
					<th width="120"><?php echo JText::_('COM_JOOSAM_THEAD_REQUESTS'); ?></th>
					
					<th><?php echo JText::_('COM_JOOSAM_THEAD_DESC'); ?></th>
				</tr>
			</thead>
			<tbody>
				<?php foreach($this->items as $i => $item): ?>
					<tr class="row<?php echo $i % 2; ?>">
						<td style="text-align:center;">
							<?php echo $item->id; ?>
						</td>
						<td style="text-align:center; padding:0 0 0 15px;">
							<?php echo JHtml::_('grid.id', $i, $item->id); ?>
						</td>
						<td style="text-align:center;">
							<?php echo $item->spname; ?>
						</td>
						<td style="text-align:center;">
							<?php if ($item->sprepeat == 'default'){ echo 'None';} else{ echo $item->spstart; } ?>
						</td>
						<td style="text-align:center;">
							<?php if ($item->sprepeat == 'default'){ echo 'None';} else{ echo $item->spends; } ?>
						</td>
						<td style="text-align:center;">
							<?php if ($item->sprepeat == 'default'){ echo 'None';} else{ echo $item->sprepeat; } ?>
						</td>
						<td style="text-align:center;"><?php
							$jsamCatReq = $item->sprequests;
							if($jsamCatReq == 'all'){ echo JText::_('COM_JOOSAM_VIEW_EVENTS_ALLOW_ALL_REQUESTS');}
							else if($jsamCatReq == 'none'){ echo JText::_('COM_JOOSAM_VIEW_EVENTS_BLOCK_ALL_REQUESTS');}
							else if($jsamCatReq == ''){ echo '<span style="color:red;">'.JText::_("COM_JOOSAM_VIEW_EVENTS_ERROR_CHECK_NEED").'</span>';}
							else{ echo JText::_('COM_JOOSAM_VIEW_EVENTS_CLICK_SHOW_LIST');} ?>
						</td>
						<td style="text-align:left; padding-left:10px;">
							<?php echo $item->spinfo; ?>
						</td>
					</tr>
				<?php endforeach; ?>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="8"><?php echo $this->pagination->getListFooter(); ?></td>
				</tr>
			</tfoot>
		</table>
	</fieldset>
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
<div class="clr"></div>
<!-- If you have respect for scriptplanet.eu you don't delete the code below -->
<div class="spCopyFooter" style="padding:0;margin:0 auto;font-size:9px;width:220px;text-align:center;"><span>JooSam created by</span><a href="http://www.scriptplanet.eu">ScriptPlanet.eu</a><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/"><img alt="Creative Commons Licentie" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/3.0/80x15.png" /></a></div>